const mongoose=require('../../cfg/dbconfig.js')
var wechattokenSchema=new mongoose.Schema({
    "expireAt":{'type':Date,index: { expires: 0 } },
    "value":String,
    "name":String
},{collection:'wechattoken'})

wechattokenSchema.statics.Save=async function(doc){
    let obj=new this(doc);
    let res=await obj.save();
    return res;
}

wechattokenSchema.statics.getByName=async function(query){
    let res=await this.findOne(query).exec();
    return res;
}

module.exports=mongoose.model('wecahttoken',wechattokenSchema)

